In H.265/AVC, encoding/decoding is carried out on a macroblock unit, and a quantization/dequantization value is allocated to each macroblock. A quantization parameter value allocated to each macroblock is predicted from a quantization parameter value of a macroblock located on the left in a frame. A differential value which is generated after prediction of the quantization parameter value is written in a macroblock to encode, thereby conducting encoding. A decoder decodes the quantization parameter value by adding the quantization parameter differential value decoded in entropy decoding and the quantization parameter value of the left macroblock.
However, when a large LCU is allocated as compared with a size of an input picture, a bit rate may not be effectively controlled using a quantization parameter value stored by an LCU. Further, when a quantization parameter value is allocated by a CU, subjective deterioration in image quality may occur due to a difference in quantization parameter value from neighboring CUs. Thus, there is a need for a method of allocating quantization parameter values to various block sizes ranging from a CU to an LCU depending on an input picture and of optimally predicting a quantization parameter using context information on blocks neighboring to a block to encode.